/**Filename: process.h
 * Author(s): Vladimir Dudnic, Michael Groenier, Derek Fleener
 * Winter 2013 TCSS422
 * Project 2
 */

#ifndef PROCESS_H
#define PROCESS_H

#include"instruction.h"

typedef enum ProcessState{
  RUNNING, BLOCKED, RUNNABLE
}ProcessState;

typedef enum ProcessType{
  UI, CALC, PROD, CONS
}ProcessType;

typedef enum IO_SOURCE{
  KEYBOARD, JOYSTICK
}IO_SOURCE;

typedef enum PROCESS_PRIORITY{
  PRIORITY_VERY_LOW, PRIORITY_LOW, PRIORITY_AVG, PRIORITY_HIGH, PRIORITY_VERY_HIGH
}PROCESS_PRIORITY;

typedef struct Process{
  int PC;
  ProcessState s;
  ProcessType t;
  Instruction* instructions;
  int instructionSize;
  int priority;
}Process;

int processInit(Process*, ProcessType ,Instruction*, int, PROCESS_PRIORITY);
Instruction processNextInstruction(Process*);
char* processStateToString(ProcessState);
char* processTypeToString(ProcessType);

Process* createUI();
Process* createCalc();
Process* createProd(int);
Process* createCons(int);

#endif
